package com.jida.hadoop.mr.useruv;

import com.jida.hadoop.mr.tools.DxFileUserReducer;
import com.jida.hadoop.mr.tools.DxFileUserMapper;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

public class DxFileUser {
	
    public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException, IllegalArgumentException, InterruptedException {
    	    	
		Job job=Job.getInstance();
        job.setJarByClass(DxFileUser.class);
		job.setMapperClass(DxFileUserMapper.class);
		job.setReducerClass(DxFileUserReducer.class);
		job.setMapOutputKeyClass(Text.class);
		job.setMapOutputValueClass(IntWritable.class);
		job.setOutputKeyClass(NullWritable.class);
		job.setOutputValueClass(Text.class);
		
		FileInputFormat.setInputPaths(job, new Path("D://测试数据/dx/02.DxFileMatch/"));
		FileOutputFormat.setOutputPath(job, new Path("D://测试数据/dx/03.DxFileUser/"));
		
        System.exit(job.waitForCompletion(true) ? 0 : 1);
    }
}